package com.example.bookstore.service.impl;

import com.example.bookstore.entity.Ordered;
import com.example.bookstore.entity.OrderLink;
import com.example.bookstore.mapper.OrderMapper;
import com.example.bookstore.service.OrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {

    @Resource
    private OrderMapper orderMapper;

    @Override
    public List<Ordered> findAllOrder() {
        List<Ordered> ordereds = orderMapper.findAllOrder();
        return ordereds;
    }

    @Override
    public Integer createOrder(Ordered order) {
        Integer id = orderMapper.createOrder(order);
        return id;
    }

    @Override
    public Integer createOrderLink(OrderLink orderLink) {
        Integer row = orderMapper.createOrderLink(orderLink);
        return row;
    }

    @Override
    public List<OrderLink> findOrderLinks(Integer orderedId) {
        List<OrderLink> list = orderMapper.findOrderLinks(orderedId);
        return list;
    }

    @Override
    public Ordered queryMyOrdered(Integer id) {
        Ordered ordered = orderMapper.queryMyOrdered(id);
        return ordered;
    }

}
